<template>
  <base-breadcrumb>
    <a-card :bordered="false">
      <title-name title="技术答辩信息" />
      <a-form-model
        ref="form1"
        :model="form"
        :rules="rules"
      >
        <a-row :gutter="24">
          <a-col
            :md="16"
            :sm="16"
          >
            <a-form-model-item
              label="所属单位"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="projectId"
            >
              <!--                        <SelectProject-->
              <!--                          v-model="form.projectId"-->
              <!--                          placeholder="请选择"-->
              <!--                          :form="form"-->
              <!--                          :is-clear="false"-->
              <!--                          key-value="branchCompanyId"-->
              <!--                          @change="getProjectDetails"-->
              <!--                        />-->
              <org-tree-select
                v-model="form.projectId"
                is-need-auth
                check-strictly
                is-auto-select-first
                @select="seletOrg"
              />
            </a-form-model-item>
          </a-col>
          <!--          <a-col-->
          <!--            :md="8"-->
          <!--            :sm="8"-->
          <!--          >-->
          <!--            <a-form-model-item-->
          <!--              label="分公司"-->
          <!--              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"-->
          <!--              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"-->
          <!--              prop="branchCompanyId"-->
          <!--            >-->
          <!--              <SelectSubCompany-->
          <!--                v-model="form.branchCompanyId"-->
          <!--                placeholder="请选择"-->
          <!--              />-->
          <!--            </a-form-model-item>-->
          <!--          </a-col>-->
          <!--          <a-col-->
          <!--            :md="8"-->
          <!--            :sm="8"-->
          <!--          >-->
          <!--            <a-form-model-item-->
          <!--              label="项目名称"-->
          <!--              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"-->
          <!--              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"-->
          <!--              prop="projectId"-->
          <!--            >-->
          <!--              <SelectProject-->
          <!--                v-model="form.projectId"-->
          <!--                placeholder="请选择"-->
          <!--                :form="form"-->
          <!--                :is-clear="false"-->
          <!--                key-value="branchCompanyId"-->
          <!--                @change="getProjectDetails"-->
          <!--              />-->
          <!--            </a-form-model-item>-->
          <!--          </a-col>-->
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="项目编号"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.projectNum"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="答辩时间"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="replyDate"
            >
              <a-date-picker
                v-model="form.replyDate"
                format="YYYY-MM-DD"
                placeholder="请选择日期"
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="招标内容"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="biddingContentId"
            >
              <!--<a-select v-model="form.biddingContentId">-->
              <!--<a-select-option v-for="item in types" :key="item.id" :value="item.id" >{{item.name}}</a-select-option>-->
              <!--</a-select>-->

              <a-tree-select
                v-model="form.biddingContentId"
                placeholder="请选择"
                style="width: 100%"
                :tree-data="types"
                multiple
                option-filter-prop="children"
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="计划选择分包商个数"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="planSubSize"
            >
              <BaseInputNumber
                v-model="form.planSubSize"
                :min="0"
                :max="10000"
                placeholder="输入计划选择分包商个数"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="24"
            :sm="24"
          >
            <a-form-model-item
              label="招标内容备注"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseTextarea
                v-model="form.biddingContentRemark"
                placeholder="请输入"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="24"
            :sm="24"
          >
            <a-form-model-item
              label="招标详细情况"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="biddingDetails"
            >
              <BaseTextarea
                v-model="form.biddingDetails"
                placeholder="请输入"
                type="textarea"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="24"
            :sm="24"
          >
            <a-form-model-item
              label="备注信息"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseTextarea
                v-model="form.remark"
                placeholder="请输入"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="创建人"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.creater"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="创建时间"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.creatorDate"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-card>

    <a-card style="margin-top: 20px">
      <title-name title="投标单位信息" />

      <div style="margin-bottom: 20px">
        <a-button
          type="primary"
          style="margin-right: 20px"
          @click="handelAdd"
        >
          新增
        </a-button>
        <a-button
          type="primary"
          @click="handdelDelete"
        >
          删除
        </a-button>
      </div>

      <a-table
        bordered
        :pagination="false"
        :columns="columnInfos"
        :data-source="dataSource"
        row-key="id"
        :row-selection="rowSelection"
      >
        <span
          slot="serial"
          slot-scope="text, record, index"
        >{{ index + 1 }}</span>
        <span
          slot="remark"
          slot-scope="text, record, index"
        >
          <ellipsis
            :length="20"
            tooltip
          >{{ text }}</ellipsis>
        </span>
        <span
          slot="action"
          slot-scope="text, record"
        >
          <a @click="handleEdit(record)">编辑</a>
        </span>
      </a-table>

      <title-name
        title="评分表等附件资料上传"
        style="margin-top: 20px;"
      />
      <u-table
        :list-url="listUrl"
        :upload-arrys="uploadArrys"
        :upload-list="uploadList"
        :delete-url="deleteUrl"
        business-code="PM19"
        @fileArrysData="fileArrysData"
      />


      <a-modal
        v-model="visible"
        width="900px"
        :title="title"
        destroy-on-close
      >
        <template slot="footer">
          <a-button
            key="back"
            @click="handleCancel"
          >
            取消
          </a-button>
          <a-button
            key="submit"
            type="primary"
            :loading="loadings"
            @click="handleOk"
          >
            确认新增
          </a-button>
        </template>
        <a-form-model
          ref="form2"
          :model="forms"
          :rules="rulesTender"
        >
          <a-row :gutter="24">
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="投标单位名称"
                :label-col="{ lg: { span: 5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                prop="name"
              >
                <!--<a-select v-model="forms.name"  @change="tendererName">-->
                <!--<a-select-option v-for="item in subcontractorLists" :key="item.id" :value="item.subcontractors">{{item.subcontractors}}</a-select-option>-->
                <!--</a-select>-->
                <a-select
                  v-model="forms.name"
                  mode="combobox"
                  show-search
                  placeholder="填写或选择合格分包商"
                  :filter-option="filterOption"
                  @popupScroll="scrollMore"
                  @change="handleChange"
                  @search="selectSearchDebounce"
                >
                  <a-select-option
                    v-for="(item,index) in subcontractorLists"
                    :key="item.id"
                    :value="item.subcontractors"
                  >
                    {{ item.subcontractors }}
                  </a-select-option>
                </a-select>
              </a-form-model-item>
            </a-col>
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="分包商来源"
                :label-col="{ lg: { span:5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
              >
                <BaseInput
                  v-model="forms.isQualified"
                  disabled
                />
              </a-form-model-item>
            </a-col>
          </a-row>
          <a-row :gutter="24">
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="答辩人"
                :label-col="{ lg: { span: 5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                prop="replier"
              >
                <BaseInput
                  v-model="forms.replier"
                  placeholder="输入答辩人"
                />
              </a-form-model-item>
            </a-col>
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="联系方式"
                :label-col="{ lg: { span:5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                prop="contactInfo"
              >
                <BaseInput
                  v-model="forms.contactInfo"
                  placeholder="请输入"
                />
              </a-form-model-item>
            </a-col>
          </a-row>
          <a-row :gutter="24">
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="是否提交答辩资料"
                :label-col="{ lg: { span: 5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                prop="isSubmitFiles"
              >
                <a-radio-group v-model="forms.isSubmitFiles">
                  <a-radio :value="1">
                    是
                  </a-radio>
                  <a-radio :value="0">
                    否
                  </a-radio>
                </a-radio-group>
              </a-form-model-item>
            </a-col>
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="答辩通过情况"
                :label-col="{ lg: { span:5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                prop="isPast"
              >
                <a-radio-group v-model="forms.isPast">
                  <a-radio :value="1">
                    通过
                  </a-radio>
                  <a-radio :value="0">
                    不通过
                  </a-radio>
                </a-radio-group>
              </a-form-model-item>
            </a-col>
          </a-row>
          <a-row :gutter="24">
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="答辩评分"
                :label-col="{ lg: { span: 5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                prop="replyScore"
              >
                <BaseInputNumber
                  v-model="forms.replyScore"
                  :min="0"
                  placeholder="请输入"
                />
              </a-form-model-item>
            </a-col>
          </a-row>
          <a-row :gutter="24">
            <a-col
              :md="24"
              :sm="24"
            >
              <a-form-model-item
                label="备注信息"
                :label-col="{ lg: { span: 5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
              >
                <BaseTextarea
                  v-model="forms.remark"
                  placeholder="请输入"
                />
              </a-form-model-item>
            </a-col>
          </a-row>
        </a-form-model>
      </a-modal>
    </a-card>

    <div class="page-btn-right-top">
      <a-button
        type="primary"
        :loading="loading"
        style="margin-right: 20px"
        @click="submit"
      >
        提交
      </a-button>
      <a-button
        type="primary"
        @click="gobackWithRemove"
      >
        关闭
      </a-button>
    </div>
  </base-breadcrumb>
</template>

<script>
  import { Ellipsis } from '@/components'
  import { getReplyBidderList,delDefenceBidders,addDefenceBidders,editDefenceBidders,addDefenceRecords, editDefenceRecords,getdefenceRecordOne,getTenderContents,delContractReply } from '@/api/subcontractors/defenceRecord'
  import { getProjectsDel } from '@/api/project/projects'
  import { getLaborSubcontractors } from '@/api/subcontractors/labor'
  import SelectSubCompany from '@/components/Select/SelectSubCompany' // 分公司
  import SelectProject from '@/components/SelectProjects/SelectProject' // 项目
  import ARow from 'ant-design-vue/es/grid/Row'
  import * as _ from 'lodash'
import { createValidator, isIntNumber } from '@/utils/regExpression'
  import { getAuditProject } from '@/api/themeChoose/themeChoose' // 正则校验

  const columns = [
    {
      title: '序号',
      scopedSlots: { customRender: 'serial' }
    },
    {
      title: '文件名称',
      dataIndex: 'assessmentName'
    },
    {
      title: '文件格式',
      dataIndex: 'assessmentScore',

    },
    {
      title: '操作',
      dataIndex: 'assessmentScore',

    },


  ]

  const columnInfos = [
    {
      title: '序号',
      scopedSlots: { customRender: 'serial' }
    },
    {
      title: '投标单位名称',
      dataIndex: 'name'
    },
    {
      title: '分包商来源',
      dataIndex: 'isQualified'
    },
    {
      title: '答辩人',
      dataIndex: 'replier'
    },
    {
      title: '联系方式',
      dataIndex: 'contactInfo'
    },
    {
      title: '是否提交答辩资料',
      dataIndex: 'isSubmitFilesName'
    },
    {
      title: '答辩通过情况',
      dataIndex: 'isPastName'
    },
    {
      title: '答辩评分',
      dataIndex: 'replyScore'
    },
    {
      title: '备注信息',
      dataIndex: 'remark',
      scopedSlots: { customRender: 'remark' }
    },
    {
      title: '操作',
      dataIndex: 'action',
      scopedSlots: { customRender: 'action' }
    },
  ]

  export default {
    name:'a'+Date.now(),
    components: {
      ARow,
      Ellipsis,
      SelectSubCompany,
      SelectProject,
    },
    data() {
      this.columns = columns
      return {
        selectSearchDebounce: null, // 对搜索方法做防抖处理
        uploadArrys:[],

        isSubmit:0, // 是否提交
        value:'',
        typeData:[{subcontractors:'111',id:1},{subcontractors:'222',id:2}], //任务类型数组

        columnInfos,
        loading:false,

        loadings:false, // 投标单位提交信息

        // 附件上传
        listUrl:'',
        deleteUrl:'/cscec-project-business/file/business/project-fileDelete',
        uploadList:'/cscec-project-business/file/business/fileUpload',
        businessId:'',

        visible:false,
        title:'新增投标单位信息',
        subcontractorLists:[],  // 投标单位名称

        isIntroduction:0,  // 是否是新引进

        dataSource:[],
        types:[],
        form:{
          creater:JSON.parse(sessionStorage.getItem('ycloud-user_info')).name,
          projectNum:'',
          creatorDate:this.getNowDate(),
        },
        // branchCompanyId projectId replyDate biddingContentId planSubSize biddingDetails

         rules: {
                  branchCompanyId: [{ required: true, message: '请选择分公司', trigger: 'change' }],
                  projectId: [{ required: true, message: '请选择项目名称', trigger: 'change' }],
                  replyDate: [{ required: true, message: '请选择答辩时间', trigger: 'change' }],
                  biddingContentId: [{ required: true, message: '请选择招标内容', trigger: 'change' }],
                  planSubSize: [{ required: true, message: '请输入计划选择分包商个数', trigger: 'blur' }],
                  biddingDetails: [{ required: true, message: '请输入招标详细情况', trigger: 'blur' }],
                },
        rulesTender:{
                 name: [{ required: true, message: '请选择投标单位名称', trigger: 'change' }],
                 replier: [{ required: true, message: '请输入答辩人', trigger: 'blur' }],
                 contactInfo: [{ required: true, message: '请输入联系方式', trigger: 'blur' },{
                   validator: createValidator(isIntNumber), message: '请输入正确的联系方式', trigger: 'blur'
                 }],
                 isSubmitFiles: [{ required: true, message: '请选择是否提交答辩资料', trigger: 'change' }],
                 isPast: [{ required: true, message: '请选择答辩通过情况', trigger: 'change' }],
                 replyScore: [{ required: true, message: '请输入答辩评分', trigger: 'blur' }],
        },
       forms:{
         name:'',
         isQualified:''  // 是否
       },
        queryParam:{
          pageNo:1,
          pageSize:10,
        },

        pageNo:1,
        pageSize:20,    // 投标单位选择
        totalPage:0,
        totalSize:0,


        dels:{},
        replyId:'',
        isEdit:0,

        selectedRowKeys: [],
        selectedRows: [],
        selectId:[],
        ids:[]
      }
    },

    created() {
      this.selectSearchDebounce = _.debounce(this.handleSelectSearch, 500)
      this.replyId = this.$route.query.replyId
      this.isEdit = this.$route.query.isEdit
      this.getLaborSubcontractors()
      this.closeTab()
      if(this.isEdit == 1){
        this.getdefenceRecordOne()
        this.getReplyBidderList()
      }
    },
    computed: {
      rowSelection() {
        return {
          selectedRowKeys: this.selectedRowKeys,
          selectedRows: this.selectedRows,   // 当前行所有数据
          onChange: this.onSelectChange
        }
      },
    },
    methods: {
      seletOrg(val) {
        if(val&&val.length) {
            this.form.branchCompanyId = val[val.length - 2].orgId;
            this.form.projectId = val[val.length - 1].projectId
            this.$refs.form1.clearValidate('projectId')
           this.getProjectDetails(this.form.projectId)
        }
      },
      gobackWithRemove(){
        this.$multiTab.deleteCallback(this.$route.fullPath)
        this.goBack()
      },
      closeTab(){
          this.$multiTab.registerCallback(this.$route.fullPath, () => {
            this.goBack()
          })
      },
      filterOption(input, option) {
        return (
          option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
        );
      },

      handleChange (value) {
        let that = this;

        if(value.length > 30){
          that.$message.error("投标单位名称不能超过30个字符！")
          that.forms.name = ""
          return;
        }

        const target = that.subcontractorLists.find((item) => item.subcontractors === value)

        if(!target){
          that.forms.isQualified = '新引进'
        }else{
          that.forms.isQualified = '合格分包商名录'
        }
        that.forms.name = value


      },
      // 下拉滚动加载
      scrollMore(e) {
        if(this.moreLoading) return
        const { target } = e
        var total = target.scrollTop + target.offsetHeight
        var scrollHeight = target.scrollHeight

        // this.pageNo是当前页 this.totalPage是总页数
        if (total >= scrollHeight - 1 && total < scrollHeight + 1 && this.pageNo <= this.totalPage ) {
          this.pageNo = this.pageNo + 1
          this.getLaborSubcontractors() // 调用api方法
        }
      },
      handleSelectSearch(val) {
        this.pageNo = 1
         this.totalPage = 0
         this.totalSize = 0
         this.subcontractorLists = []
         this.searchName = val
         this.getLaborSubcontractors()
      },
      getLaborSubcontractors(){
        this.moreLoading = true
        getLaborSubcontractors({pageNo:this.pageNo,pageSize:this.pageSize, subcontractorName: this.searchName || void 0, branchComId: this.form.branchCompanyId}).then(res=>{
          this.moreLoading = false
          if(res.code == 200){
            if(res.data){
              // 过滤掉没有subcontractors的数据，避免select组件报错、异常
              const list = res.data.filter(item => item.subcontractors)
              this.subcontractorLists = this.subcontractorLists.concat(list)
              console.log(this.subcontractorLists)
            }
            this.totalPage = res.totalPage
            this.totalSize = res.totalSize
          }
        }).catch(e => {
          this.moreLoading = false
        })
      },

      //判断数组对象中是否有某个值

      findElem(arrayToSearch,attr,val){

        for (var i=0;i<arrayToSearch.length;i++){
          if(arrayToSearch[i][attr] == val){
            return true;
          }
        }
        return false;
      },

      fileArrysData(val){
        this.form.fileArrays = val
      },
      getdefenceRecordOne(){
        getdefenceRecordOne({id:this.replyId}).then(res=>{
          this.form = res.data
          this.form.creater = JSON.parse(sessionStorage.getItem('ycloud-user_info')).name
          this.uploadArrys = res.data.fileList
          if(this.form.projectId != null){
            getTenderContents({nodeName:'招采', projectId:this.form.projectId}).then(res=>{
              this.types = res.data
            })
          }
        })
      },
      getProjectDetails(val){
        getProjectsDel({projectId:val}).then(res=>{
          this.form.projectNum = res.data.projectNum
        })
        getTenderContents({nodeName:'招采', projectId:val}).then(res=>{
          this.types = res.data
        })
      },
      onSelectChange(selectedRowKeys, selectedRows) {
        this.selectedRowKeys = selectedRowKeys
        this.selectedRows = selectedRows
      },

      goBack(){
        if(this.isSubmit == 0 && this.isEdit != 1){
          delContractReply({id:this.replyId}).then(res=>{
            if(res.data.code == 200 || res.code == 200){
              this.$multiTab.close(this.$route.fullpath)
            }
          })
        }else{
          this.$multiTab.close(this.$route.fullpath)
        }

      },

      getReplyBidderList(){
        this.queryParam.replyId = this.replyId
        getReplyBidderList(this.queryParam).then(res=>{
          this.dataSource = res.data
        })
      },

      handleEdit(record){
        console.log("当前编辑信息：",record)
        this.visible = true
        this.forms = this.$clone(record)
      },

      handdelDelete(){
        let that = this;
        if(that.selectedRowKeys.length==0){
          that.$message.error("请先选择需要删除的投标单位信息！")
          return;
        }
        that.$confirm({
          title: '警告提醒！',
          content: '确定删除投标单位信息？',
          okType: 'danger',
          onOk() {
            delDefenceBidders({ids: that.selectedRowKeys}).then(res=>{
              if(res.code == 200 || res.data.code == 200){
                that.$message.success("删除成功")
                that.selectedRowKeys = []
                that.selectedRows = []
                that.getReplyBidderList()
              }
            })
          },
          onCancel() {
          },
        });
      },

      handelAdd(){
        this.forms = {}
        this.visible = true
      },

      handleCancel(){
        this.visible = false
      },

      handleOk(){   // 确定新增
        let that = this
        that.$refs.form2.validate((err,values) => {
             if(err){
               if(that.forms.id){
                 that.forms.replyId = that.replyId
                 that.loadings = true
                 editDefenceBidders(that.forms).then(res=>{
                   that.loadings = false
                   if(res.code == 200 || res.data.code == 200){
                     that.$message.success("编辑成功")
                     that.getReplyBidderList()
                     that.visible = false
                   }else{
                     that.$message.error("编辑失败")

                   }
                 })
               }else{
                 that.forms.replyId = that.replyId
                 that.loadings = true
                 addDefenceBidders(that.forms).then(res=>{
                   that.loadings = false
                   if(res.code == 200||res.data.code == 200){
                     that.$message.success("新增成功")
                     that.getReplyBidderList()
                     that.visible = false
                   }else{
                     that.$message.error("新增失败")
                   }
                 })
               }
             } else {
               this.$message.warning("请填写完所有必填项信息")
             }
         })

      },



      submit(){   // 提交
        this.form.id = this.replyId
          this.$refs.form1.validate((err,value)=>{
            if(err){
              this.isSubmit = 1
              if(this.loading) return
              this.loading = true
                editDefenceRecords(this.form).then(res=>{
                  this.loading = false
                    if(res.code ==200 || res.data.code == 200){
                       this.$message.success("提交成功")
                       this.gobackWithRemove();
                    }else{
                       this.$message.error("编辑失败")
                    }
                }).catch(()=>{
                  this.loading = false
                })
            } else {
              this.$message.warning("请填写完所有必填项信息")
            }
          })
      },


    }
  }
</script>
<style scoped>
  /deep/ .ant-select-dropdown.ant-select-tree-dropdown.ant-select-dropdown--multiple.ant-select-dropdown-placement-bottomLeft{
    height: 200px;
  }
</style>

